'use strict'
/**
 * 用户管理控制类
 */
const Controller = require('egg').Controller;
class AdminController extends Controller {

  async index(){
    const {ctx} = this;
    let page = ctx.query.page || 1;
    let result = await ctx.service.admin.getAdminPageList(page);
    ctx.body = result;
  }

  async save(){
    const {ctx,logger} = this;
    let data = ctx.request.body;
    logger.info(data)
    let result = await ctx.service.admin.saveAdmin(data);
    ctx.body = result;
  }

  async delete(){
    const {ctx,logger} = this;
    let id = ctx.query.id;
    logger.info('***id***{}=>',id)
    let result = await ctx.service.admin.deleteAdmin(id);
    ctx.body = result;
  }
}

module.exports = AdminController;
